package swna;

import static org.junit.Assert.*;
import org.junit.Test;

public class swnaTest {
   @Test public void metrics1() {
      ProcessData dl = new ProcessData("testdata/junittest/dep1.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 0, dl.subgraphs.size());
      assertEquals("Vertices", 0, dl.nVertices);
      assertEquals("Edges", 0, dl.nEdges);
   }
   @Test public void metrics2() {
      ProcessData dl = new ProcessData("testdata/junittest/dep2.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 0, dl.subgraphs.size());
      assertEquals("Vertices", 0, dl.nVertices);
      assertEquals("Edges", 0, dl.nEdges);
   }
   @Test public void metrics3() {
      ProcessData dl = new ProcessData("testdata/junittest/dep3.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 1, dl.subgraphs.size());
      assertEquals("Vertices", 2, dl.nVertices);
      assertEquals("Edges", 1, dl.nEdges);
   }
   @Test public void metrics4() {
      ProcessData dl = new ProcessData("testdata/junittest/dep4.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 0, dl.subgraphs.size());
      assertEquals("Vertices", 0, dl.nVertices);
      assertEquals("Edges", 0, dl.nEdges);
   }
   @Test public void metrics5() {
      ProcessData dl = new ProcessData("testdata/junittest/dep5.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 1, dl.subgraphs.size());
      assertEquals("Vertices", 3, dl.nVertices);
      assertEquals("Edges", 3, dl.nEdges);
   }
   @Test public void metrics6() {
      ProcessData dl = new ProcessData("testdata/junittest/dep6.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 1, dl.subgraphs.size());
      assertEquals("Vertices", 3, dl.nVertices);
      assertEquals("Edges", 3, dl.nEdges);
   }
   @Test public void metrics7() {
      ProcessData dl = new ProcessData("testdata/junittest/dep7.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 2, dl.subgraphs.size());
      assertEquals("Vertices", 4, dl.nVertices);
      assertEquals("Edges", 2, dl.nEdges);
   }
   @Test public void metrics8() {
      ProcessData dl = new ProcessData("testdata/junittest/dep8.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 1, dl.subgraphs.size());
      assertEquals("Vertices", 3, dl.nVertices);
      assertEquals("Edges", 2, dl.nEdges);
   }
   @Test public void metrics9() {
      ProcessData dl = new ProcessData("testdata/junittest/dep9.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 3, dl.subgraphs.size());
      assertEquals("Vertices", 15, dl.nVertices);
      assertEquals("Edges", 14, dl.nEdges);
   }
   @Test public void metrics10() {
      ProcessData dl = new ProcessData("testdata/junittest/dep10.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 2, dl.subgraphs.size());
      assertEquals("Vertices", 15, dl.nVertices);
      assertEquals("Edges", 15, dl.nEdges);
   }
   @Test public void metrics11() {
      ProcessData dl = new ProcessData("testdata/junittest/dep11.txt");
      dl.calculateMetrics();
      dl.printGraphMetrics(true);
      assertEquals("Subgraphs", 1, dl.subgraphs.size());
      assertEquals("Vertices", 26, dl.nVertices);
      assertEquals("Edges", 37, dl.nEdges);
   }
   @Test public void lines() {
	   ProcessData dl = new ProcessData("testdata/checkstyle/1.dep");
	   assertEquals("line numbers", dl.parse(), 18);
   }
}
